unit newWorkNodeForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TnewWNForm = class(TForm)
    Panel1: TPanel;
    Label1: TLabel;
    nameEdit: TEdit;
    Button1: TButton;
    procedure FormShow(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure nameEditKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  newWNForm: TnewWNForm;

implementation

uses globals, workNode, mainScreen;

{$R *.dfm}

procedure TnewWNForm.FormShow(Sender: TObject);
begin
nameEdit.Text := 'WorkNode-'+IntToStr(globalView.wnList.Items.Count);
end;

procedure TnewWNForm.Button1Click(Sender: TObject);
var
  wn : baseClassData;
  i : Integer;
begin
wn := baseClassData.Create(nameEdit.Text, '', '', '', 0, WORK_NODE_TYPE);
WN_DataList.Add(wn);
i := globalView.wnList.Items.Add(wn.get_Name);
globalView.wnList.State[i] := cbUnchecked;
close;
end;

procedure TnewWNForm.nameEditKeyPress(Sender: TObject; var Key: Char);
begin
if Key = char(13) then // for enter
  Button1Click(nil);
end;

end.
